package com.tongzhan.controller;

import com.tongzhan.base.Return;
import com.tongzhan.entity.xiangxian.ExamplePoint;
import com.tongzhan.entity.xiangxian.Fengcai;
import com.tongzhan.service.XiangxianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 乡贤
 */
@RequestMapping("/xiangxian")
@RestController
public class XiangxianController {

    @Autowired
    private XiangxianService xiangxianService;

    /**
     * 获取乡贤大屏地图列表
     *
     * @return
     */
    @RequestMapping("/getMapList")
    public Return getMapList(Integer type, String date) {
        Map<String, Object> map = new HashMap<>();
        List<ExamplePoint> list = xiangxianService.getMapList(type, date);
        map.put("list", list);
        return Return.getSuccessResult(map);
    }

    /**
     * 获取乡贤社情民意列表
     *
     * @return
     */
    @RequestMapping("/getFengCaiList")
    public Return getFengCaiList(Integer type, String date) {
        Map<String, Object> map = new HashMap<>();
        List<Fengcai> list = xiangxianService.getFengCaiList(type, date);
        map.put("list", list);
        return Return.getSuccessResult(map);
    }

    /**
     * 获取乡贤基础信息统计
     *
     * @param type
     * @param date
     * @return
     */
    @RequestMapping("/getUserInfoList")
    public Return getUserInfoList(Integer type, String date) {
        Map<String, Object> map = xiangxianService.getUserInfoList(type, date);
        return Return.getSuccessResult(map);
    }

    /**
     * 获取乡贤人员信息列表
     *
     * @param type
     * @param date
     * @param name
     * @param typeId
     * @return
     */
    @RequestMapping("/getPersonnelList")
    public Return getPersonnelList(Integer type, String date, String name, Integer typeId) {
        Map<String, Object> map = xiangxianService.getPersonnelList(type, date, name, typeId);
        return Return.getSuccessResult(map);
    }

    /**
     * 获取乡贤活动中心统计
     *
     * @param type
     * @param date
     * @return
     */
    @RequestMapping("/getActionCenterList")
    public Return getActionCenterList(Integer type, String date) {
        Map<String, Object> map = xiangxianService.getActionCenterList(type, date);
        return Return.getSuccessResult(map);
    }

    /**
     * 获取乡贤参政议政统计
     *
     * @param type
     * @param date
     * @return
     */
    @RequestMapping("/getParticipationList")
    public Return getParticipationList(Integer type, String date) {
        Map<String, Object> map = xiangxianService.getParticipationList(type, date);
        return Return.getSuccessResult(map);
    }

    /*==============================================2.0版本接口===============================================*/

    /**
     * 人员统计
     *
     * @return
     */
    @RequestMapping("/personCount")
    public Return personCount(String streetCode, String villageCode) {
        return Return.getSuccessResult(xiangxianService.personCount(streetCode, villageCode));
    }

    /**
     * 人员统计详情
     *
     * @return
     */
    @RequestMapping("/personDetail")
    public Return personDetail(String streetCode, String villageCode) {
        return Return.getSuccessResult(xiangxianService.personDetail(streetCode, villageCode));
    }

    /**
     * 活动中心统计
     *
     * @return
     */
    @RequestMapping("/actionCenterCount")
    public Return actionCenterCount(String streetCode, String villageCode) {
        return Return.getSuccessResult(xiangxianService.actionCenterCount(streetCode, villageCode));
    }

    /**
     * 活动中心统计详情
     *
     * @return
     */
    @RequestMapping("/actionCenterDetail")
    public Return actionCenterDetail(String streetCode, String villageCode) {
        return Return.getSuccessResult(xiangxianService.actionCenterDetail(streetCode, villageCode));
    }

    /**
     * 品牌建设统计（统计示范点）
     *
     * @return
     */
    @RequestMapping("/brandCount")
    public Return brandCount(String streetCode, String villageCode) {
        return Return.getSuccessResult(xiangxianService.brandCount(streetCode, villageCode));
    }

    /**
     * 品牌建设统计详情（统计示范点）
     *
     * @return
     */
    @RequestMapping("/brandDetail")
    public Return brandDetail(String streetCode, String villageCode) {
        return Return.getSuccessResult(xiangxianService.brandDetail(streetCode, villageCode));
    }

    /**
     * 参政议政统计
     *
     * @return
     */
    @RequestMapping("/participationCount")
    public Return participationCount(String streetCode, String villageCode) {
        return Return.getSuccessResult(xiangxianService.participationCount(streetCode, villageCode));
    }

    /**
     * 参政议政统计详情
     *
     * @return
     */
    @RequestMapping("/participationDetail")
    public Return participationDetail(String streetCode, String villageCode) {
        return Return.getSuccessResult(xiangxianService.participationDetail(streetCode, villageCode));
    }

    @RequestMapping("/brandMapList")
    public Return brandMapList() {
        return Return.getSuccessResult(xiangxianService.brandMapList());
    }
}
